// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import FastClick from 'fastclick'
import VueRouter from 'vue-router'
// import store from './vuex/store'
import Vuex from 'vuex';
import App from './App'
Vue.use(VueRouter)

Vue.use(Vuex);
const store = new Vuex.Store({
    state: {
      isload: true,
      configs: {
        ot: "http://m.lzdkjy.cn/public/img/mr1x2.jpg"
      }
    },
    mutations: {
      increment(state) {
        state.count++
      },
      // increment (state, payload) {
      //   state.count += payload.amount
      // }
    }
  })
  // store.commit('increment')
  // store.commit('increment', {
  //   amount: 10
  // })



import VueResource from 'vue-resource'
Vue.use(VueResource);
import {
  ToastPlugin
} from 'vux'
Vue.use(ToastPlugin)



// Vue.use(Lzd)

const routes = [{
  path: '/', //首页
  // component: Home,
  component: resolve => require(['./home/index'], resolve),
  children: [{
    path: '/',
    name: 'children_home',
    // component: Homecom
    component: resolve => require(['./home/commont'], resolve) //
  }, {
    path: 'home/message',
    name: 'children_message',
    // component: Message
    component: resolve => require(['./message/index'], resolve)
  }, {
    path: 'home/personage',
    name: 'children_personage',
    component: resolve => require(['./personage/index'], resolve)
  }, {
    path: 'home/information',
    name: 'children_information',
    // component: Information
    component: resolve => require(['./information/index'], resolve)
  }]
}, { //登录
  path: '/logo',
  // component: Logo,
  component: resolve => require(['./logo/index'], resolve),
  children: [{
    path: '/', //登录
    // component: Logoindex
    component: resolve => require(['./logo/logoin'], resolve)
  }, {
    path: 'resgi',
    // component: Resgi
    component: resolve => require(['./logo/resgi'], resolve)
  }, { //
    path: 'registered',
    // component: Registered
    component: resolve => require(['./logo/registered'], resolve)
  }, { //激活账户
    path: 'emcode',
    // component: Emcode
    component: resolve => require(['./logo/emcode'], resolve)
  }]
}, { //设置
  path: '/setup',
  component: resolve => require(['./personage/setup/index'], resolve)
}, { //消息内容
  path: '/messagecont',
  component: resolve => require(['./message/content'], resolve)
}, { //文章内容
  path: '/datascont',
  component: resolve => require(['./details/datas'], resolve)
}, { //搜索内容列表
  path: '/detailslists',
  component: resolve => require(['./home/search/detailslists'], resolve)
}, { //编辑文章
  path: '/editupd',
  component: resolve => require(['./personage/edit/index'], resolve)
}, { //本地文章
  path: '/draft',
  component: resolve => require(['./personage/edit/thisuseredit'], resolve)
}]


const router = new VueRouter({
  routes
})
router.beforeEach((to, from, next) => {
  // do something
  next();
  document.body.scrollTop = 0;
  console.log(to.path)
    // store.commit('increment')isload
  store.state.isload = false
    // console.log(store.state.isload)

});

// router.afterEach((to, from, next) => {
//   console.log(to.path)
//     // return this.$store.getters.getloading;
// })
FastClick.attach(document.body)

Vue.config.productionTip = false

/* eslint-disable no-new */

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app-box')
